package com.ranjiaqi.array;

/**
 * @ClassName TestObjectArray
 * @Description TODO
 * @Author hp
 * @Date 2021/6/23 8:56
 * @Version 1.0
 **/

import com.ranjiaqi.pojo.Person;

/**
 * 引用类型的数组
 */
public class TestObjectArray {
    public static void main(String[] args) {

        //存储元素
        Person p1 = new Person();
        p1.setName("张三");
        p1.setAge(18);
        Person p2 = new Person();
        p2.setName("李四");
        p2.setAge(18);
        Person p3 = new Person();
        p3.setName("王五");
        p3.setAge(18);
        Person[] persons = {p1,p2,p3};

        for (Person person : persons) {
            System.out.println(person.toString());
        }
    }
}
